CC=gcc
MAKE=make
CFLAGS=-I$(ORACLE_HOME)/precomp/public -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME)/rdbms/demo -g
PROCFLAGS=sqlcheck=semantic userid=dbuser/oracle sys_include=$(ORACLE_HOME)/precomp/public sys_include=$(ORACLE_HOME)/rdbms/public sys_include=$(ORACLE_HOME)/rdbms/demo
LIBS=-L$(ORACLE_HOME)/lib -lclntsh -lpthread -lm -lnsl -lresolv -lrt

all : single

single : dbcom.h dbfunc.h single.c dbcom.o dbfunc.o
	$(CC) $(CFLAGS) -o $@ single.c dbcom.o dbfunc.o $(LIBS)

dbcom.o : dbcom.h dbfunc.h dbcom.pc
	proc $(PROCFLAGS) dbcom.pc
	$(CC) $(CFLAGS) -o $@ -c dbcom.c
	rm -f dbcom.c

dbfunc.o : dbcom.h dbfunc.h dbfunc.pc
	proc $(PROCFLAGS) dbfunc.pc
	$(CC) $(CFLAGS) -o $@ -c dbfunc.c
	rm -f dbfunc.c

clean :
	rm -f *.o single
